﻿package
{
	import ASF;
	import ASRock;
	import org.flixel.*;
	
	public class ASRockLarge extends ASRock
	{
		[Embed(source = 'data/rocks_big.png')] private var imgRockLarge:Class;
		public function ASRockLarge(ParentState:StateGameLoop)
		{
			super(ParentState);
			width = 32;
			height = 16;
			loadGraphic(imgRockLarge, true, false, width, height, false);
			addAnimation("rocks", [0, 1, 2]);
		}
		
		override public function spawn(X:int = -1, Y:int = -1, break_dir:int = 0):void
		{
			randomFrame();
			super.spawn(X,Y,break_dir);
		}

		override public function hurt(Damage:Number):void
		{
			var rock:ASRock;
			super.hurt(Damage);
			
			// Split in two
			rock = FlxG.getNonexist(_parentState._rocksSmall) as ASRock;
			if (rock) rock.spawn(x, y, -1);
			rock = FlxG.getNonexist(_parentState._rocksSmall) as ASRock;
			if (rock) rock.spawn(x, y, 1);
		}
		
		override public function getScore():int { return ASF.SCORE_ROCK_SMALL; }
	}

}